// run: $exec < input
#include <cstdio>
#include <algorithm>

int const  inf = 1 << 30;
int const maxn = 10007;
int const maxm = 20;
int f[maxn][maxm];
int s[maxn][maxm];
int a[maxn];
int sum[maxn];
int n, m, l;

void scan(int & a)
{
	a = 0;
	bool flag = false;
	char ch = std::getchar();
	if (ch == '-') flag = true;
	else if (ch >= '0' && ch <= '9') a = ch - '0';
	while ((ch = std::getchar()) >= '0' && ch <= '9')
		a = a * 10 + ch - '0';
	if (flag) a = -a;
}

int main()
{
	int T; scan(T);
	for (int ti = 1; ti <= T; ti++) {
		printf("Case #%d:\n", ti);
		scan(n); scan(m); scan(l);
		for (int i = 1; i <= n; i++) scan(a[i]);
		for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] ^ a[i];
		for (int i = 0; i <= n; i++)
			for (int j = 0; j <= m; j++) f[i][j] = 0;
		f[0][0] = inf;
		for (int i = 1; i <= n; i++) {
			int ti = std::min(m, i);
			s[i][ti + 1] = i;
			for (int j = ti; j >= 1; j--) {
				for (int t = s[i - 1][j]; t <= s[i][j + 1]; t++) {
					int tmp = std::min(f[t][j - 1], sum[i] ^ sum[t]);
					if (tmp > f[i][j]) {
						f[i][j] = tmp;
						s[i][j] = t;
					}
				}
			}
		}
		printf("%d\n", f[n][m]);
	}
}

